import React from 'react'
import '../style/list.css'
import axios from 'axios'

class List extends React.Component{
    constructor(props){
        super(props)
        this.state = {
            list:[]
        }
    }
    componentDidMount() {
        axios.get('http://api.kudesoft.cn/tdk/goods')
          .then(res => {
            console.log(res)
            this.setState({
              list:res.data.data.data.list
            })
          })
      }
    render(){
        return(
            <div>
                <div className="box">
                    {
                        this.state.list.map(res=>{
                            return  <div className="list_one">
                                <img src={res.mainPic} width="100%"></img>
                                {res.title}
                                </div>
                        })
                    }
                </div>
            </div>
        )
    }
}

export default List